#include "StdAfx.h"
#include <View>
#include <Document>
#include <LayerManager>

View::View(QWidget *parent)
	: QWidget(parent)
{
	setAttribute(Qt::WA_DeleteOnClose);

	m_doc = new Document(QSize(400, 300), this);
}

View::~View()
{

}

void View::paintEvent( QPaintEvent* pEvent )
{
	QPainter painter(this);
	QPointer<LayerManager> layerManager = m_doc->layerManager();
	Q_ASSERT(layerManager);

	layerManager->paint(painter);
}

QSize View::sizeHint() const
{
	return QSize(600, 400);
}

QPointer<Document> View::document() const
{
	return m_doc;
}
